package com.itheima.a01myfile;

import java.io.File;

public class demo3 {
    public static void main(String[] args) {
        //遍历整个硬盘进行查找
        findAVI();

    }

    //将硬盘放入数组
    public static void findAVI(){
        File[] files = File.listRoots();
        for (File file : files) {
            findAVI(file);
        }
    }

    public static boolean findAVI(File file) {
        File[] files = file.listFiles();
        if (files != null) {
            for (File f : files) {
                if (f.isFile()) {
                    String name = f.getName();
                    if (name.endsWith(".avi")) {
                        System.out.println(file);
                    }
                } else {
                    findAVI(f);
                }
            }
        }
        return false;
    }
}
